package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/7/8.
 */
@HttpInlet(Conn.INLET_API_INSURANCEORDER_CACCIDENTORDER)
public class PostSubmitApply extends BaseAsyPost<PostSubmitApply.Info> {

    public String userid, applicant_information, relation, other_insureds, death_beneficiary, insurance_type,
            copies, premium, payment_way, payment_is, cid, stores_id, starttime, time_limit, manager_code,
            id_url, self_url, otherid_url, otherself_url;

    public PostSubmitApply(AsyCallBack<PostSubmitApply.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");

        if (jsonObject.optInt("code") == 200) {

            Info info = new Info();

            info.message = jsonObject.optString("message");
            info.code = jsonObject.optString("code");
            info.data = jsonObject.optString("data");
            info.ordersn = jsonObject.optString("ordersn");

            return info;

        }

        return null;
    }

    @Override
    protected boolean skipSecret(String key) {
        return key.equals("id_url") || key.equals("self_url") || key.equals("otherid_url") || key.equals("otherself_url");
    }

    public static class Info {
        public String message, code, data, ordersn;
    }
}
